package com.zxl.yjb.adapter;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zxl.yjb.GlideApp;
import com.zxl.yjb.R;
import com.zxl.yjb.bean.OrderBindBean;

public class OrderListAdapter extends BaseQuickAdapter<OrderBindBean, BaseViewHolder> {


    private int oldSelectedItem = -1;

    public OrderListAdapter(int layoutResId) {
        super(layoutResId, null);

    }


    @Override
    protected void convert(BaseViewHolder holder, OrderBindBean item) {


        holder.setText(R.id.tv_order_title, item.getName());
        ImageView imageView = (ImageView) holder.getView(R.id.iv_selected);
        GlideApp.with(mContext).load(R.mipmap.login_f_normal).into(imageView);
        holder.setText(R.id.tv_order_title, item.getName());
//        holder.itemView.setTag(item.getOrder_sn());//订单号 多位
        if (item.isSelect())
        {
            GlideApp.with(mContext).load(R.mipmap.login_f_pressed).into(imageView);
        }
    }
    public void setRefrenshItem(int position) {
        if (oldSelectedItem != -1&&oldSelectedItem!=position) {
            notifyItemChanged(oldSelectedItem);
        }
        this.oldSelectedItem = position;
    }
}
